﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ZQNB.Common;
using ZQNB.Common.Data;
using ZQNB.Entity.Dics;

namespace ZQNB.BaseLib.Dics
{
    /// <summary>
    /// 字典类型
    /// </summary>
    public interface IDicTypeService : IQueryTable<DicType>
    {
        IList<DicType> List(bool? inUse);
    }

    public interface IDicItemService : IQueryTable<DicItem>
    {
        /// <summary>
        /// 根据字典类型，是否启用等参数查找字典项列表
        /// 如果为null，则忽略该参数
        /// </summary>
        /// <param name="dicType"></param>
        /// <param name="inUse"></param>
        /// <returns></returns>
        IList<DicItem> GetDicItems(string dicType, bool? inUse);
        /// <summary>
        /// 查找某一个字典项
        /// </summary>
        /// <param name="dicType"></param>
        /// <param name="dicItemCode"></param>
        /// <returns></returns>
        DicItem GetByCode(string dicType, string dicItemCode);
        MessageResult CreateOrUpdate(DicItem item);
        MessageResult Delete(DicItem item);

        /// <summary>
        /// 批量导入，有则修改，无则增加
        /// </summary>
        /// <param name="dicItems"></param>
        /// <returns></returns>
        MessageResult BatchCreateOrUpdate(IList<DicItem> dicItems);
        MessageResult BatchDelete(IList<DicItem> dicItems);
        MessageResult BatchChangeSortNumsByIds(IList<Guid> sortedIds);
        MessageResult BatchChangeInUseByIds(IList<Guid> ids, bool inUse);

    }
}
